import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const router = new VueRouter({
  mode: "hash",
  routes: [
    {
      path: "/",
      redirect: "/index",
    },
    {
      path: "/index",
      component: () =>
        import(/* webpackChunkName: "about" */ "../views/Index.vue"),
      children: [
        {
          path: "/",
          component: () =>
            import(/* webpackChunkName: "about" */ "../views/home.vue"),
        },
        {
          path: "/home",
          name: "home",
          component: () =>
            import(/* webpackChunkName: "about" */ "../views/home.vue"),
        },
        {
          path: "/userList",
          name: "userList",
          component: () =>
            import(
              /* webpackChunkName: "about" */ "../views/user/userList.vue"
            ),
        },
        {
          path: "/administrator",
          name: "administrator",
          component: () =>
            import(
              /* webpackChunkName: "about" */ "../views/user/administrator.vue"
            ),
        },
        {
          path: "/typeCreate",
          name: "typeCreate",
          component: () =>
            import(/* webpackChunkName: "about" */ "../views/type/create.vue"),
        },
        {
          path: "/typeManage",
          name: "typeManage",
          component: () =>
            import(/* webpackChunkName: "about" */ "../views/type/manage.vue"),
        },
        {
          path: "/bikeCreate",
          name: "bikeCreate",
          component: () =>
            import(/* webpackChunkName: "about" */ "../views/bike/create.vue"),
        },
        {
          path: "/bikeManage",
          name: "bikeManage",
          component: () =>
            import(/* webpackChunkName: "about" */ "../views/bike/manage.vue"),
        },
        {
          path: "/scrapNumber",
          name: "scrapNumber",
          component: () =>
            import(
              /* webpackChunkName: "about" */ "../views/bike/scrapNumber.vue"
            ),
        },
        {
          path: "/addMoney",
          name: "addMoney",
          component: () =>
            import(
              /* webpackChunkName: "about" */ "../views/money/addMoney.vue"
            ),
        },
        {
          path: "/recordsMoney",
          name: "recordsMoney",
          component: () =>
            import(
              /* webpackChunkName: "about" */ "../views/money/recordsMoney.vue"
            ),
        },
        {
          path: "/rentList",
          name: "rentList",
          component: () =>
            import(
              /* webpackChunkName: "about" */ "../views/rent/rentList.vue"
            ),
        },
        {
          path: "/returnManage",
          name: "returnManage",
          component: () =>
            import(
              /* webpackChunkName: "about" */ "../views/rent/returnManage.vue"
            ),
        },
      ],
    },
    {
      path: "/register",
      name: "register",
      component: () =>
        import(/* webpackChunkName: "about" */ "../views/Register.vue"),
    },

    // 登录页面
    {
      path: "/login",
      name: "login",
      component: () =>
        import(/* webpackChunkName: "about" */ "../views/Login.vue"),
    },

    // 404页面
    {
      path: "*",
      name: "/404",
      component: () =>
        import(/* webpackChunkName: "about" */ "../views/404.vue"),
    },
  ],
});

export default router;
